/**
 * $Revision: 1.0 $
 * $Author: Eric Yang $
 * $Date: Jan 24, 2010 11:01:35 PM $
 *
 * Author: Eric Yang
 * Date  : Jan 24, 2010 11:01:35 PM
 *
 */
package com.gooex.web.action.gbuy.category;

import org.c4j.system.web.exception.ServiceException;

import com.gooex.domain.base.Category;
import com.gooex.domain.base.Product;
import com.gooex.service.base.IProductManager;
import com.gooex.service.base.exception.ExceptionCode;
import com.gooex.web.action.BaseProtectedAction;

/**
 * @author Eric Yang
 * @version 1.0
 */
public class CategoryViewAction extends BaseProtectedAction {
	private IProductManager productManager;

	private String target;

	private String categoryId;

	private String productId;

	private Category category;

	private Product product;

	private String act;

	public String selectCategory() throws Exception {
		category = categoryManager.getCategory(categoryId);
		return SUCCESS;
	}

	public String updateCategory() throws Exception {
		product = productManager.getProduct(productId);
		if (product == null) {
			throw new ServiceException(ExceptionCode.SYSTEM_ACCESS_ERROR, "");
		}
		category = product.getCategory();

		return SUCCESS;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public String getAct() {
		return act;
	}

	public void setAct(String act) {
		this.act = act;
	}

	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public String getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	public void setProductManager(IProductManager productManager) {
		this.productManager = productManager;
	}

}
